package com.eliza.base.viewrouter

import androidx.compose.material.icons.Icons
import androidx.compose.material.icons.rounded.PlayArrow
import androidx.compose.material.icons.rounded.ThumbUp
import androidx.compose.runtime.Composable
import androidx.compose.ui.graphics.vector.ImageVector
import androidx.navigation.NavController
import androidx.navigation.NavGraphBuilder
import androidx.navigation.NavHostController
import androidx.navigation.compose.composable
import androidx.navigation.compose.navigation
import com.eliza.base.views.database.broadcast.BroadcastScreen
import com.eliza.base.views.database.crud.DataBaseCrudScreen
import com.eliza.base.views.database.data.FlowScreen
import com.eliza.base.views.database.game.GameScreen
import com.eliza.library.ui.inter.IBaseRoute
import com.eliza.library.ui.inter.INavScreen

enum class NavDataBaseEnum(
    override val title: String,
    override val imageVector: ImageVector,
    override val content: @Composable (NavController) -> Unit
) : IBaseRoute {
    Game("Game", Icons.Rounded.PlayArrow, { GameScreen(it) }),
    CRUD("CRUD", Icons.Rounded.ThumbUp, { DataBaseCrudScreen(it) }),
    BroadcastScreen("BroadcastScreen", Icons.Rounded.ThumbUp, { BroadcastScreen(it) }),
    FlowScreen("FlowScreen", Icons.Rounded.ThumbUp, { FlowScreen(it) })
    ;

    companion object : INavScreen {
        override fun RegisterRoute(navController: NavHostController, nav: NavGraphBuilder) {
            nav.navigation(
                startDestination = Game.title,
                route = "NavDataBaseEnum"
            ) {
                NavDataBaseEnum.entries.forEach { route ->
                    // 显示添加导航参数 (参数列表)
                    composable(route.title) {
                        route.content(navController)
                    }
                }
            }
        }

    }

}
